package org.cshoo.sys.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import mx.rpc.events.ResultEvent;
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import mx.collections.ArrayCollection;
	import org.cshoo.sys.event.FindParameterListEvent;
	import org.cshoo.sys.business.ParameterDelegate;
	import org.cshoo.sys.model.SysModelLocator;
	import org.cshoo.sys.model.vo.Parameter;
	
	public class FindParameterListCommand implements ICommand, IResponder
	{
		
		private var _model:SysModelLocator = SysModelLocator.getInstance();	
		
		public function execute(event:CairngormEvent):void
		{
			var parameter:Parameter = (event as FindParameterListEvent).parameter;
			var parameterDelegate:ParameterDelegate = new ParameterDelegate(this);
			parameterDelegate.findParameterList(parameter);
		}
		
		public function result(event:Object):void
		{
			var collection:Array = (event as ResultEvent).result as Array;
			_model.parameterCollection = collection;
		}
		
		public function fault(info:Object):void
		{
			Alert.show("无法连接");
		}
	}
}